﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleAppCheckDir
{
    public static class ObjExtension
    {
        public static bool IsNullOrEmpty(this string str)
        {
            return string.IsNullOrEmpty(str) || str.Trim().Length == 0;
        }

        public static bool IgnoreCaseEquals(this string source, string target)
        {
            if (source.IsNullOrEmpty() || target.IsNullOrEmpty())
                return false;
            return source.Equals(target, StringComparison.OrdinalIgnoreCase);
        }

        public static bool IsEquals(this string source, params string[] targerts)
        {
            if (source.IsNullOrEmpty() || targerts == null || targerts.Length == 0)
                return false;
            foreach (var targert in targerts)
            {
                if (source.IgnoreCaseEquals(targert))
                {
                    return true;
                }
            }

            return false;
        }
    }
}
